package com.jeecg.demo.entity;

import java.util.HashMap;
import java.util.Map;
import org.jeecgframework.core.util.StringUtil;
//import org.apache.commons.lang.StringUtils;


public class Infomation {
    
//    private static String fileServerPath = ConfigTool.getProConfig("server.file_out");
    private static String fileServerPath = null;
	private int newsId;// 主键
	private String newsPic;// 预览图片路径
	private String newsTitle;// 标题
	private String newsModule;// 所属模块
	private String newsContent;// 内容
	private String newsStatus;// 状态：发布/未发布
	private String newsDate;//
	private String updateDate;//
	private int scCount;// 收藏数
	private String isCarousel;// 是否轮播
	private String termNum;//
	private String newsSource;// 新闻来源
	private int setTop;// 置顶：1 未置顶：0
	private int readCount;// 阅读数'
	private String isSubject;// 是否专题
	private String isPictbrow;// 是否图片浏览
	private int subjectCode; // 专题号

	private String isBigPhonto;// 是否大图片
	
	

	public Infomation(){}
	public Infomation(Map dbData) {
	    MapProcessNullValue map = new MapProcessNullValue(dbData);
        setNewsId(map.getInt("INFO_ID"));
        setNewsPic(map.getString("PIC_PATH"));
        setNewsTitle(map.getString("TITLE"));               
        setNewsDate(map.getString("CREATE_DATE").substring(0,10));
        setNewsSource(map.getString("SOURCE"));
        setReadCount(map.getInt("READ_COUNT"));
        setScCount(map.getInt("COLLECTION_NUM"));
    }

    public String getIsSubject() {
		return isSubject;
	}

	public void setIsSubject(String isSubject) {
		this.isSubject = isSubject;
	}

	public String getIsPictbrow() {
		return isPictbrow;
	}

	public void setIsPictbrow(String isPictbrow) {
		this.isPictbrow = isPictbrow;
	}

	public int getSubjectCode() {
		return subjectCode;
	}

	public void setSubjectCode(int subjectCode) {
		this.subjectCode = subjectCode;
	}

	public String getIsBigPhonto() {
		return isBigPhonto;
	}

	public void setIsBigPhonto(String isBigPhonto) {
		this.isBigPhonto = isBigPhonto;
	}

	public int getNewsId() {
		return newsId;
	}

	public void setNewsId(int newsId) {
		this.newsId = newsId;
	}

	public String getNewsPic() {
	    if(StringUtil.isEmpty(newsPic)||newsPic.contains("http://")){
	        return newsPic;
	    }
		return fileServerPath+"/"+newsPic;
	}

	public void setNewsPic(String newsPic) {
		this.newsPic = newsPic;
	}

	public String getNewsTitle() {
		return newsTitle;
	}

	public void setNewsTitle(String newsTitle) {
		this.newsTitle = newsTitle;
	}

	public String getNewsContent() {
		return newsContent;
	}

	public void setNewsContent(String newsContent) {
		this.newsContent = newsContent;
	}

	public String getIsCarousel() {
		return isCarousel;
	}

	public String getTermNum() {
		return termNum;
	}

	public String getNewsModule() {
		return newsModule;
	}

	public void setNewsModule(String newsModule) {
		this.newsModule = newsModule;
	}

	public String getNewsStatus() {
		return newsStatus;
	}

	public void setNewsStatus(String newsStatus) {
		this.newsStatus = newsStatus;
	}

	public void setIsCarousel(String isCarousel) {
		this.isCarousel = isCarousel;
	}

	public void setTermNum(String termNum) {
		this.termNum = termNum;
	}

	public String getNewsDate() {
		return newsDate;
	}

	public void setNewsDate(String newsDate) {
		this.newsDate = newsDate;
	}

	public String getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(String updateDate) {
		this.updateDate = updateDate;
	}

	public int getScCount() {
		return scCount;
	}

	public void setScCount(int scCount) {
		this.scCount = scCount;
	}

	public String getNewsSource() {
		return newsSource;
	}

	public void setNewsSource(String newsSource) {
		this.newsSource = newsSource;
	}

	public int getSetTop() {
		return setTop;
	}

	public void setSetTop(int setTop) {
		this.setTop = setTop;
	}

	public int getReadCount() {
		return readCount;
	}

	public void setReadCount(int readCount) {
		this.readCount = readCount;
	}
	
}

class MapProcessNullValue extends HashMap{
    private static final long serialVersionUID = 1L;
    
    public MapProcessNullValue(){
        super();
    }
    
    public MapProcessNullValue(Map map){
        super(map);
    }
    
    public String getString(String key){
        return get(key)==null?"":get(key).toString();
    }
    
    public int getInt(String key){
        return get(key)==null?0:Integer.parseInt(get(key).toString());
    }
}